﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Text;

namespace WebChatApi.Common.Constants
{
    /// <summary>
    /// Class ContentTypeCollection.
    /// </summary>
    public static class ContentTypeCollection
    {
        public const string Html = "text/html";

        /// <summary>
        /// Generates the type of the content.
        /// NOTE: Default is text/html.
        /// </summary>
        /// <param name="contentTypeString">The content type string.</param>
        /// <returns></returns>
        public static ContentType GenerateContentType(string contentTypeString)
        {
            ContentType result = null;
            try
            {
                result = new ContentType(contentTypeString);
            }
            catch { }

            return result == null ? new ContentType(ContentTypeCollection.Html) : result;
        }
    }
}
